package com.rao.travel.dao;

import com.rao.travel.pojo.Product;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author Srao
 * @version 1.0
 * @className ProductDao
 * @date 2019/10/25 13:06
 * @package com.rao.travel.dao
 * @description
 */
@Mapper
public interface ProductDao {
    /*查询所有商品*/
    @Select("select * from product")
    List<Product> findAll() throws Exception;

    /*保存商品*/
    @Insert("insert into product(productNum, productName, cityName, departureTime, productPrice, productDesc, productStatus) values (#{productNum}, #{productName}, #{cityName}, #{departureTime}, #{productPrice}, #{productDesc}, #{productStatus})")
    void save(Product product);

    /*根据商品id查询商品*/
    @Select("select * from product where id = #{id}")
    Product findById(String id) throws Exception;
}
